extension :deployment => :copy do
  
  task :deploy do
    archived_output = syscmd_output("tar -cf - -C #{revision_deployment.deployment_root} ./ | gzip -c", true)

    run "mkdir -p '#{revision_deployment.deployment_root}'"
    put archived_output, "#{File.join(revision_deployment.deployment_root, "deployment.tar.gz")}"
    run "tar -C '#{revision_deployment.deployment_root}' -xzf  '#{File.join(revision_deployment.deployment_root, "deployment.tar.gz")}'"
  end

  task :link_deployment do
    run "sh '#{File.join(revision_deployment.deployment_root, link_script_name)}' '#{revision_deployment.deployment_root}'"    
  end

  task :unlink_deployment do
    run "sh '#{File.join(revision_deployment.deployment_root, unlink_script_name)}'"
  end

  task :remove_deployment do
    run "rm -rf '#{revision_deployment.revision_root}'"
  end
  
end